package com.laikan.reader.core.view;

public enum EnumContentType {

    TITLE(1, "标题"),
    CONTENT(2, "正文"),
    AUTHOR_SAY(3, "作者说");

    int type;
    String desc;

    EnumContentType(int type, String desc) {
        this.type = type;
        this.desc = desc;

    }

    /**
     * 这种方式太慢
     *
     * @param str
     *
     * @return
     */
    public static EnumContentType getType(int type) {
        if (type == 1) {
            return EnumContentType.TITLE;
        }else if (type == 2) {
            return EnumContentType.CONTENT;
        }else if (type == 3) {
            return EnumContentType.AUTHOR_SAY;
        }
        return null;
    }

    public int getValue() {
        return type;
    }
}
